﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Header.ascx.cs" Inherits="ForeProgram_controls_Header" %>
<%--<%@ Register Assembly="AjaxControlToolkit"  Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>--%>
<%--<ajaxToolkit:ToolkitScriptManager runat="server" ID="ScriptManager2" />--%>
<script type="text/javascript">
    function searchKeyword() {
        var keyword = document.getElementById('<%= txtKeyWord.ClientID %>').value;
        keyword = keyword.replace(/[&%_#/'/"]/g, "");	//除掉%_#的特殊字符
        if (keyword == '请输入您要查询的商品关键字' || keyword == "") {
            alert('请输入要查找的商品关键字!');
            document.getElementById('<%= txtKeyWord.ClientID %>').value = "";
            document.getElementById('<%= txtKeyWord.ClientID %>').focus();
            return false;
        }
        return true;
    }

	function keyUpFunction(e) {
	    e = window.event || e;
	    if (e.keyCode == 13) {
	        return searchKeyword();
	    }
	}
</script>
    <div id="header2011">
        <!--头部开始-->
        <asp:Button ID="btnLoad" runat="server" Text="Load" style="display:none"  onclick="btnLoad_Click" />

        <!--头部 LOGO区-->
        <div class="header2011_top">
            <dl>
                <dt class="link3">
                    <div class="nonli">欢迎你 <asp:Label ID="lblName" runat="server" Text="0"></asp:Label>
                    </div>
                    <div class="li">
                        <em></em><a href="logout.aspx">
                            [注销]</a>
                    </div>
                    <div class="li">
                        <em>
                            <img src="images/header_member.gif" width="16" height="16"></em> <a href="shopMyUserInfo.aspx">
                                我的账号</a>
                    </div>
                    <div class="li">
                        <em>
                            <img src="images/header_help.gif"></em> <a href="http://www.homevv.com/vvshopHelpCenter.jhtml"
                                target="_blank">帮助中心</a>
                    </div>
                    <div class="li">
                        <em>
                            <img style="cursor: pointer" border="0" src="images/header_kefu.gif">
                        </em><a href="#" onclick="javascript:window.open('http://b.qq.com/webc.htm?new=0&sid=800038073&eid=2188z8p8p8p8P8z8p8y8P&o=www.homevv.com&q=7', '_blank', 'height=544, width=644,toolbar=no,scrollbars=no,menubar=no,status=no');">
                            在线客服</a></div>
                </dt>
                <div class="clear">
                </div>
                <dd>
                </dd>
            </dl>
            <!-- 首页LOGO广告位 开始 -->
            <div title="乐随行网上商城" class="logo" style="width: 380px">
                <a href="product.aspx">
                    <img src="images/logo.png" alt="" style="margin-top: 7px">
                </a>
            </div>
            <!-- 首页LOGO广告位 结束 -->
            <div class="clear">
            </div>
            <div class="clear">
            </div>
        </div>
        <!--头部 导航菜单区-->
        <div class="nav">
            <div class="navLeftBg">
                <div class="navRightBg">
                    <div class="mainNav" id="navigation" runat="server">
                    </div>
                </div>
            </div>
            <div class="clear">
            </div>
        </div>

        <!--搜索区 开始 -->
        <div class="searchbar">
            <div class="shopping_expense">
                <%--<img src="images/expense.gif">--%></div>
            <div class="shopping_search">
                <div  style="vertical-align:top" class="inpbox2">
                    <asp:TextBox ID="txtKeyWord"   onkeyup="return keyUpFunction(event);" onfocus="if (this.value=='请输入您要查询的商品关键字') this.value=''"
                        size="14" value='请输入您要查询的商品关键字'  Columns="32" runat="server"></asp:TextBox>
                </div>
                <div class="com">
                    <asp:ImageButton ID="imgSearch" CssClass="button2" ImageUrl="../images/button.gif"   OnClientClick="return searchKeyword();" runat="server"  onclick="imgSearch_Click" />
                </div>
            </div>
            <!--购物车 开始 -->
            <div class="shopping_cart">
                <div class="rowr">
                    <ul id="Cart">
                        <li class="C_num">
                            <div>购物车里有&nbsp;<strong id="cargoNum"><asp:Label ID="lblProduct" runat="server" Text="0"></asp:Label></strong>&nbsp;件商品
                            </div>
                        </li>
                        <li class="C_bal">
                            <asp:HyperLink ID="hlSettle" runat="server">去结算</asp:HyperLink>
                        
                        </li>
                        <li class="C_ord"><a href="shopOrderCenter.aspx">
                            我的订单</a> </li>
                </div>
            </div>
        </div>
    </div>

<link rel="stylesheet" type="text/css" href="<%=Page.ResolveClientUrl("~/ForeProgram/css/jquery.autocomplete.100303.css")%>" />
<script type="text/javascript" src="<%=Page.ResolveClientUrl("~/Scripts/jquery.100303.js")%>"></script>
<script type="text/javascript" src="<%=Page.ResolveClientUrl("~/Scripts/jquery.autocomplete.100303.js")%>"></script>
<script type="text/javascript">
    function findValue(li) {
        if (li == null) return alert("No match!");

        // if coming from an AJAX call, let's use the CityId as the value
        if (!!li.extra) var sValue = li.extra[0];

        // otherwise, let's just display the value in the text box
        else var sValue = li.selectValue;

        //alert("The value you selected was: " + sValue);
    }

    function selectItem(li) {
        findValue(li);
    }

    function formatItem(row) {
        return row[0] + " (id: " + row[1] + ")";
    }

    jQuery("#"+'<%= txtKeyWord.ClientID %>').autocomplete('controls/AutoComplete.ashx', {
        delay: 10,
        minChars: 1,
        matchSubset: 1,
        matchContains: false,
        onItemSelect: selectItem,
        onFindValue: findValue,
        autoFill: false,
        maxItemsToShow: 10,
        scroll: false,
        selectFirst: false,
        highlight: false
    });

</script>